﻿using AuthCenter.Api.Read.Application.Command.Apply;
using AuthCenter.Api.Read.Application.Output;
using AuthCenter.Domain;
using AuthCenter.ErrorCode;
using MediatR;
using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Mvc;
using NPOI.XSSF.UserModel;

namespace AuthCenter.Api.Read.Controllers
{
    [Route("api/[controller]/[action]")]
    [ApiController]
    [Authorize]
    public class ApplyController : ControllerBase
    {
        private readonly IMediator _mediator;
        public ApplyController(IMediator mediator)
        {
            _mediator = mediator;
        }
        /// <summary>
        /// 显示申请列表
        /// </summary>
        /// <param name="request"></param>
        /// <param name="cancellationToken"></param>
        /// <returns></returns>
        [HttpGet]
        public Task<ApiPaging<ApplyModel>> GetApplyShow([FromQuery]GetApplyCommand request) 
        {
            return _mediator.Send(request);
        }

        /// <summary>
        /// 获取报表数据
        /// </summary>
        /// <param name="request"></param>
        /// <param name="cancellationToken"></param>
        /// <returns></returns>
        /// <exception cref="NotImplementedException"></exception>
        [HttpGet]
        public Task<ApiResult<ReportOutput>> GetReportShow([FromQuery]GetReportShowCommand request) 
        {
            return _mediator.Send(request);
        }
        /// <summary>
        /// 获取月度请假明细
        /// </summary>
        /// <param name="request"></param>
        /// <returns></returns>
        [HttpGet]
        public Task<ApiResult<List<LeaveRecordOutput>>> GetMonthShow([FromQuery] GetMonthlyLeaveDetailCommand request)
        {
            return _mediator.Send(request);
        }


    }
}
